using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;
using CStock;



using CapitalReSources;


namespace CGrid
{
	/// <summary>
	/// Summary description for GridBase.
	/// </summary>
    public class GridShareDetails : GridBase, IGridShowPortfolio
	{
		#region attributes


        protected IMainClass mainClass;


		#endregion

		#region constructor

		public GridShareDetails():base()
		{
			
			try
			{
                

                this.mainClass = MainClass.Instance;

				this.mainClass.GridDataView = this;
				this.CreateGrid(CUtil.GridTypes.ShareDetails, true);
			}
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error in creating GridShareDetails: " + ex.Message);
            }
			

			
			

		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			
			base.Dispose( disposing );
		}
		#endregion



		#region methods

		public void ShowPortfolio(IPortfolio port)
		{
			this.ClearGridRows();
			for(int i = 0; i < port.DataItems.Count; i++)
			{
				IDataItem di = port.DataItems[i];
				this.AddRow_Single(di, true);
			}

		}

		#endregion

	
	}
}
